-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bot config #38
Bot config #38
Conversation
@pavlovcik can you take a look? |
If it's stable let's just merge it and I'll continue working on it on my branch |
ok lets merge then |
// } | ||
return { valid: true, error: null }; | ||
// } catch (error) { | ||
// throw console.trace(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are errors still logging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this code is not used anymore, I have to remove it
@@ -33,7 +33,7 @@ export enum GitHubEvent { | |||
export enum UserType { | |||
User = "User", | |||
Bot = "Bot", | |||
// Organization = "Organization", | |||
Organization = "Organization", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought this is a hallucination
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it was failing the payload validation
@@ -79,7 +78,7 @@ export const processors: Record<string, Handler> = { | |||
post: [], | |||
}, | |||
[GitHubEvent.PUSH_EVENT]: { | |||
pre: [validateConfigChange], | |||
pre: [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it needs to execute before loading the config because loading it will fail if it's invalid. It's here now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have another approach for reimplementation of this feature? The purpose of it as you may recall is to immediately diagnose broken configs. Which can happen regularly with partners as they update them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just moved it here, it's still working.
Now thinking about it, it might make sense to merge it with loadConfiguration
@@ -63,7 +63,8 @@ | |||
"prettier": "^2.7.1", | |||
"probot": "^12.2.4", | |||
"tsx": "^3.12.7", | |||
"yaml": "^2.2.2" | |||
"yaml": "^2.2.2", | |||
"zod": "^3.22.4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you said you had to remove zod
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, my bad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging anyways but address these comments and make adjustments in a new pull request if necessary. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I don't remembering removing that, it might be an accident
d057dc6
into
0x4007:feat/contributor-incentives-total-scoring
From the Telegram conversation 🖼 https://github.com/ubiquity-whilefoo/ubiquibot-config/blob/main/.github/ubiquibot-config.yml i cross referenced your org config. its not clear to me how to enable the slash commands ill dig through the source code in a bit 🖼 let me know how to fix my config https://github.com/pavlovcik/ubiquibot-config/blob/development/.github/ubiquibot-config.yml chatgpt says my yaml is correct so perhaps your code isnt properly implemented also it should be throwing errors if my config is wrong so you need to restore that capability also i dont think you're loading from the ubiquibot-config-default.ts anymore? that seems wrong i think i found the issue: i had an almost empty repo config. im pretty sure that becuase i had no properties for commands, it overwrote and set them all to false. of course this must be fixed. i just deleted the local repo config and now the start command seems to work. 🖼 also trying to understand why wallet is false when its set to true in the config |
# I do not understand how to respond to that command |
Some additional points:
|
# I do not understand how to respond to that command |
# I do not understand how to respond to that command |
The problem was that repo and org were validated and defaults were added automatically and after that the lodash merged them so repo defaults overwrote org properties, so the fix is to first merge the configs and then validate and add defaults. However I'm still not sure if lodash can merge arrays correctly because I don't know how it chooses the key to merge by or it just joins them, so I propose we change it to: commands:
start: true
stop: false OR commands:
start:
enabled: true
# ...other future properties
stop:
enabled: false
# ...other future properties This will also prevent duplicates and Typescript can detect if some are missing. |
Perhaps we shouldn’t use lodash if it has this limitation. We should aim to make the configuration expressive and partner friendly. I think it’s more intuitive to simplify further such as
etc. which to my understanding represents an array of strings. |
Actually lodash has a mergeWith function that accepts a custom function, I'll try that first |
I can make it merge object arrays by a certain property such as |
Taking a step back, I feel the only part of the configuration that is a headache to deal with / is not super intuitive are the commands being enabled. Perhaps we can focus on simplifying or taking a different approach related to those? Otherwise I think that object assign should be pretty much fine for all primitive values. For example, if a key exists on an org and repo config in the same place, we clobber and take the repo config string. I wonder what structure makes the most sense for commands. I suppose that an array of strings isn't a primitive data type. This is verbose but what about new root-level property names that are the command names? Another idea is that we take the opposite approach with our commands and enable all by default BUT have disables on the repository (or even org) level? In this case we can have that array of strings: disabled:
| start
| stop
| query
Given that we rarely disable commands, I feel that this might be the right approach. Not to complicate things further but when I disabled on ubiquibot the other week, I wished that we were able to also leave an automated message for why to efficiently explain to the contributors. That structure may look more like this: disabled:
start: A large refactor is happening at https://github.com/ubiquity/ubiquibot/pull/644 please standby until this is completed.
query: User privacy is prioritized in this organization.
|
If we use Another case with this problem are the labels because they are array of objects: labels:
time:
- name: a
- name: b
priority:
- name: a |
I think this might be okay. At least for our purposes. I can't think of a time where I needed the capability to selectively enable for a repository while the command was disabled on all the others.
From the partner's perspective this does not seem intuitive. The last idea I have for now is to manage this in Supabase with a new command. This is probably reasonable to do if we can't find a good, partner friendly, config schema for these commands. However I have mixed feelings on it because I think it makes the most sense to be able to manage the repository settings in one place (instead of now potentially three places- two yml and one database) |
# I do not understand how to respond to that command |
# I do not understand how to respond to that command |
I still have some issues because of circular dependencies